//移入移出
require(["../../static/conf/config.js"], function () {
    require(["jquery"], function ($) {
        let $city = $(".current-city")
        let $cityList = $(".current-city-list")
        let $message = $(".header-message")
        let $messageList = $(".message-list-header")
        let $applist = $("#app-list")
        let $APP = $("#APP")
        let $weixin = $(".footer-weixin")
        let $weixinErweima = $(".footer-weixin-erweima")
        let $footApp = $(".footer-app")
        let $appErweima = $(".footer-app-erweima")
        $weixin.mouseenter(function () {
            $weixinErweima.show("slow");
        })
        $weixin.mouseleave(function () {
            $weixinErweima.hide();
        })
        $footApp.mouseenter(function () {
            $appErweima.show("slow");
        })
        $footApp.mouseleave(function () {
            $appErweima.hide();
        })
        $APP.mouseenter(function () {
            $applist.show("slow");
        })
        $applist.mouseleave(function () {
            $applist.hide();
        })
        $city.mouseenter(function () {
            $cityList.show("slow");
        })
        $cityList.mouseleave(function () {
            $cityList.hide();
        })
        $message.mouseenter(function () {
            $messageList.show("slow");
        })
        $messageList.mouseleave(function () {
            $messageList.hide();
        })
    })
})

require(["../../static/conf/config.js"], function () {
    require(["jquery"], function ($) {
        $(".numLogin").click(function () {
            $("#form-content").css({
                display: "block"
            })
            $("#login-content").css({
                display: "none"
            })
            $(this).addClass("active")
            $(".telLogin").removeClass("active")
        })
        $(".telLogin").click(function () {
            $("#login-content").css({
                display: "block"
            })
            $("#form-content").css({
                display: "none"
            })
            $(this).addClass("active")
            $(".numLogin").removeClass("active")
        })

        let userValue = null;
        let passValue = null;
        $(".login-button").click(function () {
            userValue = $(".loginName").val().replace(/(^\s*)|(\s*$)/g, '')
            passValue = $(".password").val().replace(/(^\s*)|(\s*$)/g, '')
            let obj = JSON.parse(localStorage.getItem("userinfo"));
            let _length = obj.length;
            let count = null;
            for (let i = 0; i < _length; i++) {
                if (userValue == obj[i].username) {
                    count = i;
                }
            }
            if (count == null && userValue !== "" && passValue !== "") {
                $(".err-text").children("i").css({
                    display: "block"
                })
                $(".err-text").children("span").text("账号不存在")
                return false;
            }
            if (userValue == "") {
                $(".err-text").children("i").css({
                    display: "block"
                })
                $(".err-text").children("span").text("用户名不能为空")
                return false;
            }
            if (passValue == "") {
                $(".err-text").children("i").css({
                    display: "block"
                })
                $(".err-text").children("span").text("密码不能为空")
                return false;
            }
            if (passValue == obj[count].password) {
                localStorage.setItem("logined", userValue);
                alert("正在转入首页")
                setTimeout(function () {
                    window.location = "../home/home.html"
                }, 2000)

            }
            if (passValue !== obj[count].password) {
                $(".err-text").children("i").css({
                    display: "block"
                })
                $(".err-text").children("span").text("账号/密码错误")
                return false;
            }

        })

    })
})